package com.springboot.myspringbootframework.domain.user.service.impl;

import com.springboot.myspringbootframework.domain.user.dao.UserMapper;
import com.springboot.myspringbootframework.domain.user.entities.User;
import com.springboot.myspringbootframework.domain.user.entities.UserExample;
import com.springboot.myspringbootframework.domain.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User getUser(Integer id) {
        return userMapper.selectByPrimaryKey(1);
    }

    @Override
    public List<User> getAllUsers() {
        UserExample example = new UserExample();
        UserExample.Criteria criteria = example.createCriteria();
        return userMapper.selectByExample(example);
    }
}
